export default async function fetchApi(url: string) {
  const res = await fetch('http://localhost:3000' + url)
  const data = await res.json()
  if(!data.success) {
    throw new Error('请求失败')
  } else {
    return data
  }
} 